CREATE TABLE AdministrationGroupPermissions
(
	PK_ID int identity primary key,
	FK_Group int not null,
	Permission nvarchar(200)
);
[GO]

CREATE TABLE AdministrationGroups
(
	PK_ID int identity primary key,
	GroupName nvarchar(200)
);
[GO]

CREATE TABLE AdministrationUserGroups
(
	PK_ID int identity primary key,
	FK_User int not null,
	FK_Group int not null
);
[GO]

CREATE TABLE AdministrationUsers
(
	PK_ID int identity primary key,
	EmailAddress nvarchar(300) not null,
	NT_Username nvarchar(200),
	FA_PasswordHash nvarchar(40),
	RealName nvarchar(200),
	IsSuperUser bit not null,
	Extradata XML
);
[GO]

CREATE TABLE EventLog
(
	PK_ID int identity primary key,
	DateTimeStamp datetime not null,
	FK_User int,
	Severity int not null,
	Type int not null,
	Class nvarchar(50),
	App nvarchar(200),
	Message nvarchar(1024)
);
[GO]

CREATE TABLE Registry
(
	PK_ID int identity primary key,
	FK_ParentID int not null,
	KeyName nvarchar(100) not null,
	KeyType int not null,
	ValueString nvarchar(500)
);
[GO]

CREATE TABLE UpdateAddins
(
	PK_ID int identity primary key,
	GUID nvarchar(150),
	AddinName nvarchar(200),
	VersionString nvarchar(50)
);
[GO]

CREATE TABLE ScheduledTasks
(
	PK_ID int identity primary key,
	TaskName nvarchar(500) not null,
	ExecuteNext datetime not null,
	Finished bit not null,
	Frequency int not null,
	Interval int not null,
	TimesRemaining int not null,
	[Execute] nvarchar(500) not null,
	TaskExpires bit not null,
	ExpireTask datetime
);
[GO]